Skip to content

Fix GH-14874: report correct line for property/const variance errors#57

Closed
iliaal wants to merge 1 commit intomasterfrom
fix/gh-14874-property-const-variance-lineno
Closed

Fix GH-14874: report correct line for property/const variance errors#57
iliaal wants to merge 1 commit intomasterfrom
fix/gh-14874-property-const-variance-lineno

Conversation

@iliaal
Copy link
Copy Markdown
Owner

@iliaal iliaal commented May 9, 2026

Fixes php#14874. Adds a uint32_t line field to zend_property_info and zend_class_constant captured from the AST node, so the variance emitters route through zend_error_at_noreturn and point at the offending child member. Members left at line 0 (internal classes, trait-copied properties) fall back to the legacy emitter.

@iliaal iliaal force-pushed the fix/gh-14874-property-const-variance-lineno branch 2 times, most recently from fbfd02a to d407cc1 Compare May 9, 2026 22:35
Add a uint32_t line field to zend_property_info and zend_class_constant,
populated from the AST node lineno at compile time. The variance
emitters route through zend_error_at_noreturn so the error points at
the offending child member rather than the class declaration. Members
left at line 0 (internal classes, trait-copied properties) fall back
to zend_error_noreturn (legacy behavior, no regression).

Fixes phpGH-14874
@iliaal iliaal force-pushed the fix/gh-14874-property-const-variance-lineno branch from d407cc1 to 4525613 Compare May 9, 2026 23:08
@iliaal
Copy link
Copy Markdown
Owner Author

iliaal commented May 9, 2026

Submitted upstream as php#21993.

@iliaal iliaal closed this May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect lineno for property and class const variance check

1 participant